package com.example.a2207_zh.mvvm

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import com.example.a2207_zh.R

abstract class BaseViewFragment<VDB: ViewDataBinding>: Fragment()  {
    lateinit var binding:VDB
    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        // Inflate the layout for this fragment
        binding = DataBindingUtil.inflate(inflater,getLayout(),container,false)
        initView()
        initData()
        return binding.root
    }

    abstract fun getLayout():Int
    abstract fun initView()
    abstract fun initData()
}